import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn } from 'typeorm';
import { ApiProperty } from '@nestjs/swagger';

@Entity('cancel_rule',{database:'daijia_rule'}) // 指定数据库表名
export class CancelRule {
  @ApiProperty({ description: '规则ID', example: 1 })
  @PrimaryGeneratedColumn({ type: "bigint", comment: "主键id" })
  id: number;

  @ApiProperty({ description: '规则名称', example: '取消规则示例' })
  @Column({ type: 'varchar', length: 200, nullable: false, comment: '规则名称' })
  name: string;

  @ApiProperty({ description: '规则内容', example: '这是取消规则的具体描述...' })
  @Column({ type: 'text', nullable: false, comment: '规则内容' })
  rule: string;

  @ApiProperty({ description: '状态：1-启用，2-禁用', example: 2 })
  @Column({ type: 'tinyint', nullable: false, default: 2, comment: '状态：1-启用，2-禁用' })
  status: number;

  @ApiProperty({ description: '创建时间', example: '2023-01-01T00:00:00.000Z' })
  @CreateDateColumn({
    type: 'timestamp',
     comment: '创建时间',
  })
  create_time: Date;

  @ApiProperty({ description: '更新时间', example: '2023-01-01T00:00:00.000Z' })
  @UpdateDateColumn({
    type: 'timestamp',
     comment: '更新时间',
  })
  update_time: Date;

  @ApiProperty({ description: '是否删除：0-未删除，1-已删除', example: 0 })
  @Column({ type: 'tinyint', nullable: false, default: 0, comment: '是否删除：0-未删除，1-已删除' })
  is_deleted: number;
}